*** Settings ***
Library           DateTime
Library           String
Resource          ../Keywords/公共/公共关键字2.0.robot
Resource          ../Resources/Global_Variables.robot
Library           Collections

*** Variables ***
${ReqDataFile}    ${CURDIR}${/}TS_UGCAI功能入口列表配置接口.conf
${RandomElement}    ${EMPTY}

*** Test Cases ***
列表配置成功
    #获取当前时间的日、小时、分钟
    ${current_time}=    Get Current Date    result_format=%Y-%m-%d %H:%M:%S
    ${date_part}=    Get Substring    ${current_time}    8    10
    ${hour_part}=    Get Substring    ${current_time}    11    13
    ${minute_part}=    Get Substring    ${current_time}    14    16
    ${time_string}=    Set Variable    ${date_part}${hour_part}${minute_part}
    # MD5加密
    #${md5}=    Generate MD5 Hash    ${time_string}
    ${md5_passwd}=    Evaluate    hashlib.md5('${time_string}'.encode()).hexdigest()    modules=hashlib
    Log    MD5哈希值: ${md5_passwd}
    ${ReqDataList}    ${RandomElementValue}    获取请求报文    ${ReqDataFile}    ${RandomElement}    ReqData1
    ${json_string}=    Get From List    ${ReqDataList}    0
    ${data_dict}=    Evaluate    json.loads('''${json_string}''')    json
    ${ReqData}    Get From Dictionary    ${data_dict}    data
    Log    ${ReqData}
    #AI功能入口列表配置
    &{params}=    Create Dictionary    pass=${md5_passwd}
    ${response}    发送Post请求    ${Host}    /ugc-server/walle/ai/skill/list/config    headers=&{G_Header}    data=${ReqData}    params=&{params}
    # 断言
    Should Be Equal As Strings    ${response.json()["code"]}    200
